import { getCommentList } from "@/api/pages";
import { List } from "vant";
export default {
  data() {
    return {
      skip: 0,
      limit: 10,
      commentFinished: false,
      commentLoading: false,
      commentList: [],
    };
  },
  components: {
    [List.name]: List,
  },
  mounted() {},
  methods: {
    //获取评论
    getCommentList() {
      let { uid, article_id, skip, limit } = this;
      getCommentList({
        user_id: uid,
        article_id,
        skip,
        limit,
      })
        .then((res) => {
          console.log(res);
          if (res.code == 0) {
            this.commentList.push(...res.data);
            let len = this.commentList.length;
            console.log(res);
            if (len >= res.count) {
              this.commentFinished = true;
            } else {
              this.skip = len;
              this.commentLoading = false;
              console.log(1);
            }
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
